<template>
  <div class="Word">
    <div>Count=<input id="Text1" type="text" value="0">
	</div>
   <!-- 此div用来加载PageOffice客户端控件，其中div的高宽及位置就决定了控件的大小及位置 -->
		<div style="width:auto; height:900px;" v-html="poHtmlCode"></div>
  </div>
</template>

<script>
import request from '@/utils/request'
export default {
	data() {
		return {
			poHtmlCode: '',
      count: 0
		}
	},
	created: function () {
		// 请求后端打开文件
		this.openFile().then(response => {
			this.poHtmlCode = response;
		});
	},
  methods: {
    updateCount(value) {
      this.count = this.count +  parseInt(value);
      document.getElementById("Text1").value = this.count;
      return this.count.toString();
    },
    ShowModalDlg() {
      pageofficectrl.ShowHtmlModalDialog(
        "../HtmlDialog/Modal",
        "abcdefg",
        "left=300px;top=390px;width=560px;height=410px;"
      )
    },
    ShowModelessDlg() {
      pageofficectrl.ShowHtmlModelessDialog(
        "../HtmlDialog/Modeless",
        "123456",
        "left=300px;top=390px;width=560px;height=410px;"
      )
    },
    OnPageOfficeCtrlInit() {
      pageofficectrl.AddCustomToolButton("弹出模态窗口", "ShowModalDlg()", 0);
      pageofficectrl.AddCustomToolButton("弹出非模态窗口","ShowModelessDlg()",0);
    },
		openFile() {
			return request({
				url: '/HtmlDialog/Word',
				method: 'get',
			})
		}
	},
	mounted: function () {
		//将当前页面methods中定义的函数挂载到PageOffice控件，例如控件触发的事件、自定义按钮触发的函数。
		window.POPageMounted = this;//此行必须
	}
}
</script>
